package com.spring.starter;

import com.spring.starter.aspectJ.TrackCounter;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.context.annotation.ImportResource;

import java.util.ArrayList;
import java.util.List;

/**
 * @author tonywang
 * @date 6/15/2018
 */
@Configuration
@EnableAspectJAutoProxy
@ImportResource("classpath:aspect-config.xml")
public class TrackCounterConfig {
    @Bean
    @Qualifier("trackCountDisc")
    public CompactDisc trackCountDisc(){
        BlankDisc cd = new BlankDisc();
        cd.setTitle("神话");
        cd.setArtist("成龙");
        List<String> tracks = new ArrayList<>();
        tracks.add("星月神话");
        tracks.add("一次就好");
        tracks.add("说谎");
        tracks.add("通话");
        cd.setTracks(tracks);
        return cd;
    }
    @Bean
    public TrackCounter trackCounter(){
        return new TrackCounter();
    }
}
